//
//  RegisterViewController.swift
//  aj
//
//  Created by leeqb on 15/11/20.
//  Copyright © 2015年 powerlee. All rights reserved.
//

import UIKit

class LGRegisterViewController: AJBaseViewController {
    @IBOutlet weak var number: UITextField!
    
    @IBAction func nextStep(sender: CBButton) {
        let params = ["userTel":self.number.text!]
        CBMessage.shareInstance().showProcessing()
        AJNetworkHelper.instance.post("aj_user_reg_sms_apply", parameters: params, success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!) -> Void in
            // 请求成功
            if (responseObject["returnCode"] as? String == "000000"){
                let registerTwo = LB("LGLogin", vcName: "RegisterTwo") as! LGRegisterTwoViewController
                registerTwo.maskNum = self.number.text!
                self.navigationController?.pushViewController(registerTwo, animated: true)
            } else {
                CBAlertView.shareInstance().showMsg(responseObject["errorMsg"] as? String)
            }
            }, failed: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in
                CBAlertView.shareInstance().showMsg("号码输入错误，请重新输入！")
            }) { () -> Void in
                CBMessage.shareInstance().dismiss()
        }
    }
    
}
